package com.lemote.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 
 * @author slaton
 * @time 2011-7-16 上午10:50:56
 * @Version:0.0.1
 * @since smt
 */
@Entity
@Table(name="smt_order")
//默认的缓存策略.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class OrderEntity extends IdEntity {

	/**
	 * 电路板
	 */
	private List<CircuitBoard> boards;
	
	/**
	 * CPU编号
	 */
	private String cpuNo;
	
	/**
	 * 录入日期
	 */
	private Date createDate;
	
	/**
	 * 完工日期
	 */
	private Date endDate;
	
	/**
	 * 成品料号
	 */
	private String finishedPartNo;
		
	private Flow flow;
	
	/**
	 * 集成电路板子结束编号
	 */
	private String icEndNo;
	
	/**
	 * 集成电路板子开始编号
	 */
	private String icStartNo;
	
	/**
	 * 订单数量
	 */
	private Integer num;
	
	/**
	 * 订单号
	 */
	private String orderNo;
	
	/**
	 * 下单人
	 */
	private User orderUser;
	
	/**
	 * 箱数量
	 */
	private Integer packNum;
	/**
	 * 每箱数量
	 */
	private Integer packsize;
	
	/**
	 * pmon版本号
	 */
	private String pmonVersion;
	
	/**
	 * 产品名称
	 */
	private String productName;
	
	/**
	 * 程序版本
	 */
	private String programVersion;
	
	/**
	 * 需求日期
	 */
	private Date requireDate;
	
	/**
	 * 开工日期
	 */
	private Date startDate;
	
	/**
	 * 状态 0：未开始，可修改，删除;1：开始，不可修改，不可删除; 2:已结单，只可查看
	 */
	private String status;
	
	/**
	 * 系统名称
	 */
	private String systemName;
	
	/**
	 * 系统版本
	 */
	private String systemVersion;
	
	/**
	 * 良率
	 */
	private Float yield;
	

	@OneToMany(mappedBy = "orderEntity",cascade=CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = CircuitBoard.class)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public List<CircuitBoard> getBoards() {
		return boards;
	}

	public String getCpuNo() {
		return cpuNo;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public String getFinishedPartNo() {
		return finishedPartNo;
	}

	@ManyToOne
	@JoinColumn(name="flowid")
	public Flow getFlow() {
		return flow;
	}

	public String getIcEndNo() {
		return icEndNo;
	}
	

	public String getIcStartNo() {
		return icStartNo;
	}

	public Integer getNum() {
		return num;
	}

	public String getOrderNo() {
		return orderNo;
	}

	@ManyToOne
	@JoinColumn(name="userid")
	public User getOrderUser() {
		return orderUser;
	}

	public Integer getPackNum() {
		return packNum;
	}

	public String getPmonVersion() {
		return pmonVersion;
	}

	public String getProductName() {
		return productName;
	}

	public String getProgramVersion() {
		return programVersion;
	}

	public Date getRequireDate() {
		return requireDate;
	}

	public Date getStartDate() {
		return startDate;
	}

	public String getStatus() {
		return status;
	}

	public String getSystemName() {
		return systemName;
	}

	public String getSystemVersion() {
		return systemVersion;
	}

	public Float getYield() {
		return yield;
	}

	public void setBoards(List<CircuitBoard> boards) {
		this.boards = boards;
	}

	public void setCpuNo(String cpuNo) {
		this.cpuNo = cpuNo;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public void setFinishedPartNo(String finishedPartNo) {
		this.finishedPartNo = finishedPartNo;
	}

	public void setFlow(Flow flow) {
		this.flow = flow;
	}

	public void setIcEndNo(String icEndNo) {
		this.icEndNo = icEndNo;
	}

	public void setIcStartNo(String icStartNo) {
		this.icStartNo = icStartNo;
	}

	public void setNum(Integer num) {
		this.num = num;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public void setOrderUser(User orderUser) {
		this.orderUser = orderUser;
	}

	public void setPackNum(Integer packNum) {
		this.packNum = packNum;
	}

	public void setPmonVersion(String pmonVersion) {
		this.pmonVersion = pmonVersion;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public void setProgramVersion(String programVersion) {
		this.programVersion = programVersion;
	}

	public void setRequireDate(Date requireDate) {
		this.requireDate = requireDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public void setSystemName(String systemName) {
		this.systemName = systemName;
	}

	public void setSystemVersion(String systemVersion) {
		this.systemVersion = systemVersion;
	}

	public void setYield(Float yield) {
		this.yield = yield;
	}

	public Integer getPacksize() {
		return packsize;
	}

	public void setPacksize(Integer packsize) {
		this.packsize = packsize;
	}
	
}
